//
//  StuPersonEduViewController.m
//  test
//
//  Created by 朱圳 on 2017/12/19.
//  Copyright © 2017年 朱圳. All rights reserved.
//

#import "StuPersonEduViewController.h"
#import "UserModel.h"
#import "UserManager.h"
#import "CommentHisVC.h"
#import "UIButton+BtnTime.h"
@interface StuPersonEduViewController ()
@property (weak, nonatomic) IBOutlet UILabel *name;
@property (weak, nonatomic) IBOutlet UILabel *phone;
@property (weak, nonatomic) IBOutlet UILabel *qq;
@property (weak, nonatomic) IBOutlet UILabel *weixin;
@property (weak, nonatomic) IBOutlet UIImageView *img;
@property (strong, nonatomic) UserModel *model;
@property (weak, nonatomic) IBOutlet UIButton *btn;
@property (weak, nonatomic) IBOutlet UIImageView *btnimg;

@end

@implementation StuPersonEduViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.edgesForExtendedLayout=UIRectEdgeNone;
    
    if ([self.titles isEqualToString:@"1"]) {
         [self setJData];
    }else{
        [self setZData];
    }
   
}

-(void)setJData{
    self.title = @"教务老师";
    self.model = [UserManager me];
    self.name.text = self.model.jname;
    self.phone.text = self.model.jphone;
    self.qq.text = self.model.jqq;
    self.weixin.text = self.model.jwechat;
    NSString *imgUrl = [NSString stringWithFormat:@"%@%@",ImageBaseURL,self.model.jpic];
    [self.img sd_setImageWithURL:[NSURL URLWithString:imgUrl] placeholderImage:[UIImage imageNamed:@"头像"]];
}

-(void)setZData{
    self.title = @"专业老师";
    self.model = [UserManager me];
    self.name.text = self.model.pname;
    self.phone.text = self.model.pphone;
    self.qq.text = self.model.pqq;
    self.weixin.text = self.model.pwechat;
    self.btn.hidden = YES;
    self.btnimg.hidden = YES;
    NSString *imgUrl = [NSString stringWithFormat:@"%@%@",ImageBaseURL,self.model.ppic];
    [self.img sd_setImageWithURL:[NSURL URLWithString:imgUrl] placeholderImage:[UIImage imageNamed:@"头像"]];
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}
- (IBAction)conmentBtn:(UIButton *)sender {
    CommentHisVC * vc = [[CommentHisVC alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}

- (IBAction)call:(UIButton *)sender {
    [sender buttonWithTime:0.05];
    NSMutableString * str=[[NSMutableString alloc] initWithFormat:@"tel:%@",self.phone.text];
    UIWebView * callWebview = [[UIWebView alloc] init];
    [callWebview loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:str]]];
    [self.view addSubview:callWebview];
}

@end
